<template>
  <div class="login-container">
    <div class="login-box">
      <div class="login-header">
        <div class="logo">
          <span class="logo-icon">B</span>
          <span class="logo-text">ERP</span>
        </div>
        <h2 class="login-title">企业资源管理系统</h2>
      </div>
      
      <div class="login-form">
        <div class="form-item">
          <el-input 
            v-model="loginForm.username" 
            placeholder="请输入账号"
            :prefix-icon="User"
          />
        </div>
        
        <div class="form-item">
          <el-input 
            v-model="loginForm.password" 
            placeholder="请输入密码"
            :prefix-icon="Lock"
            type="password"
          />
        </div>
        
        <div class="form-item remember-row">
          <el-checkbox v-model="loginForm.remember">记住密码</el-checkbox>
        </div>
        
        <div class="form-item">
          <el-button type="primary" class="login-button" @click="handleLogin">登 录</el-button>
        </div>
      </div>
      
      <div class="login-footer">
        <div class="footer-item">星辰平台</div>
        <div class="footer-item">关于我们</div>
        <div class="footer-item">同城合作伙伴</div>
      </div>
    </div>
    
    <div class="company-info">
      <div class="company-text">BAISON百胜软件 · 成就您的电商梦想</div>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive } from 'vue'
import { User, Lock } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'

// 定义特殊布局，不使用默认布局
definePageMeta({
  layout: false
})

const router = useRouter()

// 登录表单数据
const loginForm = reactive({
  username: '',
  password: '',
  remember: false
})

// 处理登录
const handleLogin = () => {
  // 这里添加登录逻辑
  if (!loginForm.username || !loginForm.password) {
    ElMessage.error('请输入账号和密码')
    return
  }
  
  // 模拟登录请求
  setTimeout(() => {
    // 登录成功后跳转到首页
    router.push('/')
  }, 500)
}
</script>

<style lang="scss" scoped>
.login-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #e8f0ff 0%, #f5f8ff 100%);
  background-size: cover;
  position: relative;
  
  .login-box {
    width: 400px;
    padding: 30px 40px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    
    .login-header {
      text-align: center;
      margin-bottom: 40px;
      
      .logo {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 10px;
        
        .logo-icon {
          display: flex;
          align-items: center;
          justify-content: center;
          width: 40px;
          height: 40px;
          background-color: #1e80ff;
          color: #fff;
          border-radius: 4px;
          font-size: 22px;
          font-weight: bold;
        }
        
        .logo-text {
          margin-left: 10px;
          font-size: 24px;
          font-weight: bold;
          color: #333;
        }
      }
      
      .login-title {
        font-size: 18px;
        color: #333;
        margin: 0;
        font-weight: normal;
      }
    }
    
    .login-form {
      .form-item {
        margin-bottom: 20px;
      }
      
      .remember-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
      
      .login-button {
        width: 100%;
        height: 42px;
        font-size: 16px;
        border-radius: 21px;
      }
    }
    
    .login-footer {
      display: flex;
      justify-content: center;
      margin-top: 30px;
      font-size: 12px;
      color: #999;
      
      .footer-item {
        position: relative;
        padding: 0 10px;
        cursor: pointer;
        
        &:not(:last-child)::after {
          content: '';
          position: absolute;
          right: 0;
          top: 50%;
          transform: translateY(-50%);
          width: 1px;
          height: 12px;
          background-color: #ddd;
        }
      }
    }
  }
  
  .company-info {
    position: absolute;
    bottom: 20px;
    text-align: center;
    
    .company-text {
      color: #666;
      font-size: 12px;
    }
  }
}

// 兼容Element Plus的输入框样式
:deep(.el-input__wrapper) {
  background-color: #f5f7fa;
  border-radius: 4px;
  box-shadow: none;
  border: 1px solid #dcdfe6;
  padding: 0 15px;
}

:deep(.el-input__inner) {
  height: 42px;
}

:deep(.el-checkbox__inner) {
  border-radius: 2px;
}
</style> 